home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Light ROM Gold
/
Light ROM Gold.iso
/
arexx
/
modeler
/
point2ob.lwm
< prev
next >
Wrap
Text File
|
1993-12-25
|
2KB
|
103 lines
---------------------------begin "Points2Objects.lwm------------
----------
/* CMD: Points to Objects *
* $VER: V1.0 *
* *
* Takes points in FG, object in BG, and replaces points w
ith *
* objects in an empty layer.=09=09=09=09=09=09=09=09=09=09=09 */
/* By Darren Reid, =A91993 Innovision Strategic Communications. */
=09mxx=3D"LWModelerARexx.port"
=09signal on error
=09signal on syntax
=09mxx_add =3D addlib(mxx,0)
=09call mai
n
=09if (mxx_add) then call remlib(mxx)
=09exit
=09syntax:
=09error:
=09t=3DNotify(1,'!Rexx Script Error','@'ErrorText(rc),'Line 'SIGL)
=09if (mxx_add) then call remlib(mxx)
=09exit
main:
syscode =3D "Points To Objects"
tmpnam =3D "t:P2O.tmp"
/* Use xfrm mode t
o scan through points, storing coordinates to tmp file.
*/
if (~open(plist, tmpnam, 'W')) then return
n =3D xfrm_begin()
if (n =3D 0) then do
call close(plist)
return
end
call meter_b
egin(n, syscode, "Reading Points")
do i=3D1 to n
call writeln(plist, xfrm_getpos(i))
call meter_step()
end i
call meter_end()
call xfrm_end()
call close(plist)
/* Get object data from current BG layer */
orignl =3D CURLAYER()
bglayer =3D CURBLAYER()
call SETLAYER(bglayer)
box =3D BOUNDINGBOX()
parse var box garbage x1 x2 y1 y2 z1 z2
cx=3D(x2+x1)/2
cy=3D(y2+y1)/2
cz=3D(z2+z1)/2
call COPY
call SETLAYER(orignl)
/* Goto an empty layer. If none, replace current data.
*/
emp =3D emptylaye
rs()
if (words(emp) =3D 0) then call delete()
else call setlayer(word(emp,1))
worklayer =3D CURLAYER()
call SETLAYER(bglayer)
if (words(emp) < 2) then call delete()
else call setlayer(word(emp,2))
scratchlayer =3D CURLAYER()
/* Read the point coordinates back in and create new data consisting
* of objects.
*/
if (~open(pli
st, tmpnam, 'R')) then return
do i=3D1 to n
vector =3D readln(plist)
parse var vector x y z
dx =3D (x - cx)
dy =3D (y - cy)
dz =3D (z - cz)
cx =3D (cx +
dx)
cy =3D (cy + dy)
cz =3D (cz + dz)
call PASTE()
call MOVE(dx dy dz)
call CUT()
call SETLAYER(worklayer)
call PASTE()
call SETLAYER(scratchlayer)
end i
call SETLAYER(worklayer)
return